////////////////////////////////////////////////////////////////
// Screen_GL.h
// OpenGL Screen implmentation
//
////////////////////////////////////////////////////////////////

#ifndef _SCREEN_GL
#define _SCREEN_GL

#include <gl\freeglut.h>
#include "..\framework\Frm_Material.h"
#include "Manager_Texture.h"

class Screen_GL
{
   public:
   	Screen_GL(void):_Gfx2D(false){};
      ~Screen_GL(void){};
      bool Init(void);
      void Shape(uint16 pw, uint16 ph);
      void Start_Draw(void){ClearScreen();};
      void End_Draw(void){glutSwapBuffers();};
      void SetColor(uchar pr, uchar pg, uchar pb){glColor4f(pr/255, pg/255, pb/255, 1.0f);};
      void SetFont(void* pFont);
      void Print(std::string pText, Frm::Vertex pV);
      void PrintFPS(uint32 pDelta);

		void SelectTexture(uint16 pID){glBindTexture(GL_TEXTURE_2D, _TxtMgr.GetID(pID));};
      void SetMaterial(Frm::Material* &pMaterial);

      void TwoD(void);
      void ThreeD(void);

      bool Load(uchar pType, std::string &pFileName);
      bool Unload(uchar pType, uint16 pIndex);
      uint16 SetTextureID(std::string &pFileName){return _TxtMgr.SetTexture(pFileName);};
      void Reset(void); //reloads Textures
      uint16 GetRessSize(uchar pType);

      //Methods for texture conversions on loading (temporary)
      void SetTargetType(uchar pTargetType){_TxtMgr.SetTargetType(pTargetType);};
      void SetTranspColor(uchar pr, uchar pg, uchar pb){_TxtMgr.SetTranspColor(pr, pg, pb);};

   private:
      bool _Gfx2D;   //tells the type of projection: 2D or 3D
      void ClearScreen(void);
      bool InitGLScene(GLvoid);

      void* _cFont; //current glut font
      bool BitmapFont;

      //Specialized Texture Manager for OpenGL
      Manager_Texture _TxtMgr;
};

#endif
